package com.example.mapreduce.partitionerandwritableComparable;

/**
 * Created with IntelliJ IDEA.
 * ClassName: FolwReducer
 * Package: com.example.mapreduce.writable
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-07-15
 * Time: 11:57
 */

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class FlowReducer extends Reducer<FlowBean, Text,Text, FlowBean> {

    //是按照总流量进行排序的 但是 不同的手机号存在相同的总流量
    //又要把不同的手机号输出 所以要遍历这个相同的总流量
    @Override
    protected void reduce(FlowBean key, Iterable<Text> values, Context context) throws IOException, InterruptedException {

        //values 存储的就是手机号
        for (Text value : values){
            context.write(value,key);
        }


    }
}